﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TagViewModel.cs" company="Concept Architecture">
//   (c) 2010 Muhammad Umer Farooq
// </copyright>
// <summary>
//   Defines the TagViewModel type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Hisaab.Client.Modules.Core.Tag.ViewModel
{
    using Hisaab.Client.Common.BaseClasses;

    using Microsoft.Practices.Prism.Regions;

    /// <summary>
    ///  Defines the <seealso cref="TagViewModel"/> type.
    /// </summary>
    public class TagViewModel : ViewModelBase, INavigationAware
    {
        /// <summary>
        /// Member field _id
        /// </summary>
        private int _id;

        /// <summary>
        /// Gets or sets the id.
        /// </summary>
        /// <value>The id.</value>
        public int Id
        {
            get
            {
                return _id;
            }

            set
            {
                RaisePropertyChangingEvent("Id");
                _id = value;
                RaisePropertyChangedEvent("Id");
            }
        }

        #region Implementation of INavigationAware

        /// <summary>
        /// Called when [navigated to].
        /// </summary>
        /// <param name="navigationContext">The navigation context.</param>
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            if (navigationContext.Parameters["ID"] != null)
            {
                Id = int.Parse(navigationContext.Parameters["ID"]);
            }
        }

        /// <summary>
        /// Determines whether [is navigation target] [the specified navigation context].
        /// </summary>
        /// <param name="navigationContext">The navigation context.</param>
        /// <returns>
        /// true if [is navigation target] [the specified navigation context]; otherwise, false.
        /// </returns>
        public bool IsNavigationTarget(NavigationContext navigationContext)
        {
            return true;
        }

        /// <summary>
        /// Called when [navigated from].
        /// </summary>
        /// <param name="navigationContext">The navigation context.</param>
        public void OnNavigatedFrom(NavigationContext navigationContext)
        {
        }

        #endregion Implementation of INavigationAware
    }
}